/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.gov.fasepa.sgpf.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author marcosdj
 */
@Entity
@Table(name = "readaptacao")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Readaptacao.findAll", query = "SELECT r FROM Readaptacao r"),
    @NamedQuery(name = "Readaptacao.findById", query = "SELECT r FROM Readaptacao r WHERE r.id = :id"),
    @NamedQuery(name = "Readaptacao.findByDataReadaptacao", query = "SELECT r FROM Readaptacao r WHERE r.dataReadaptacao = :dataReadaptacao"),
    @NamedQuery(name = "Readaptacao.findByCargoAnterior", query = "SELECT r FROM Readaptacao r WHERE r.cargoAnterior = :cargoAnterior"),
    @NamedQuery(name = "Readaptacao.findByNovoCargo", query = "SELECT r FROM Readaptacao r WHERE r.novoCargo = :novoCargo")})
public class Readaptacao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "data_readaptacao")
    @Temporal(TemporalType.DATE)
    private Date dataReadaptacao;
    @Basic(optional = false)
    @Column(name = "cargo_anterior")
    private String cargoAnterior;
    @Basic(optional = false)
    @Column(name = "novo_cargo")
    private String novoCargo;
    @Lob
    @Column(name = "observacao")
    private String observacao;
    @JoinColumn(name = "servidor", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Servidor servidor;

    public Readaptacao() {
    }

    public Readaptacao(Integer id) {
        this.id = id;
    }

    public Readaptacao(Integer id, Date dataReadaptacao, String cargoAnterior, String novoCargo) {
        this.id = id;
        this.dataReadaptacao = dataReadaptacao;
        this.cargoAnterior = cargoAnterior;
        this.novoCargo = novoCargo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDataReadaptacao() {
        return dataReadaptacao;
    }

    public void setDataReadaptacao(Date dataReadaptacao) {
        this.dataReadaptacao = dataReadaptacao;
    }

    public String getCargoAnterior() {
        return cargoAnterior;
    }

    public void setCargoAnterior(String cargoAnterior) {
        this.cargoAnterior = cargoAnterior;
    }

    public String getNovoCargo() {
        return novoCargo;
    }

    public void setNovoCargo(String novoCargo) {
        this.novoCargo = novoCargo;
    }

    public String getObservacao() {
        return observacao;
    }

    public void setObservacao(String observacao) {
        this.observacao = observacao;
    }

    public Servidor getServidor() {
        return servidor;
    }

    public void setServidor(Servidor servidor) {
        this.servidor = servidor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Readaptacao)) {
            return false;
        }
        Readaptacao other = (Readaptacao) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Readaptacao[ id=" + id + " ]";
    }
    
}
